
export default {
    list(structureType: string = 's', roomName: string = ''): string {

        let resultStr = ''
        if (!roomName) {
            let st
            switch (structureType) {
                case 's':
                    st = STRUCTURE_STORAGE
                    break
                case 'c':
                    st = STRUCTURE_CONTAINER
                    break
            }
            Object.values(Game.rooms).forEach((roomObj) => {
                const room = roomObj as Room
                if (!room || !room.controller || !room.controller.owner || room.controller.owner.username != 'noahw') {
                    return
                }
                const storeObj = room[st]
                if (storeObj && !storeObj[0]) {
                    resultStr += '[' + room.name + '] ' + storeObj.store[RESOURCE_ENERGY] + '\n'
                }
                else {
                    Object.values(storeObj).forEach((containerObj) => {
                        const container = containerObj as StructureWithStore
                        resultStr += '[' + room.name + '] ' + container.store[RESOURCE_ENERGY] + '\n'
                    })
                }
            })
        }
        return `[资源列表] 房间资源: \n${resultStr}`
    },

    /**
     * 帮助
     */
    help() {
        return 'list(roomName)'
    }
}

